package com.qiantu.api.http.Request;

import androidx.lifecycle.LifecycleOwner;

import com.hjq.http.EasyHttp;
import com.hjq.http.listener.HttpCallback;
import com.qiantu.api.entity.KGXAddData;
import com.qiantu.api.entity.KGXcollectionData;
import com.qiantu.api.http.DataApi;
import com.qiantu.api.http.model.HttpData;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class KGXRequest {
    //保存设备集合信息
    public static void editdevicecollectinfo(LifecycleOwner lifecycleOwner, KGXcollectionData collectionData, HttpCallback<HttpData<Void>> listener) {
        Map<String, Object> data = new HashMap<>();
        data.put("deviceCollectSerialNo", collectionData.getDeviceCollectSerialNo());
        data.put("controllerSerialNo", collectionData.getControllerSerialNo());
        data.put("protocolAddress", collectionData.getProtocolAddress());
        data.put("name", collectionData.getName());
        EasyHttp.post(lifecycleOwner)
                .api(new DataApi("device/controller/editdevicecollectinfo", data))
                .request(listener);
    }
    public static void deletedevicecollect(LifecycleOwner lifecycleOwner, KGXcollectionData collectionData, HttpCallback<HttpData<Void>> listener) {
        Map<String, Object> data = new HashMap<>();
        data.put("deviceCollectSerialNo", collectionData.getDeviceCollectSerialNo());
        data.put("controllerSerialNo", collectionData.getControllerSerialNo());
        EasyHttp.post(lifecycleOwner)
                .api(new DataApi("device/controller/deletedevicecollect", data))
                .request(listener);
    }
}
